# program Eigens(theMat,theEigs,theVecs) # Finds theEigs,theVecs from theMat.
#
#
#
# This text file explains and gives examples of
# some of the routines in the file All Library Routines, which
# should be Opened before trying any of these examples.
#################
##############
# xCOD external routines. xEIG2 is called by xCOMPLEX_EIG_SPLIT
# and is used for no other purpose. (The code was too big to fit in
# one xCOD, which has a 32k size limit.)
#
xCOMPLEX_EIG_SPLIT
# xCOD xCOMPLEX_EIG_SPLIT(N:num; matR,matI,eigR,eigI,vecsR,vecsI, w1,w2,w3:RealArray;xCOD xEIG2(dum:num); Err:num); finds eigen values/vectors of a complex matrx. In: real and complex parts matR[1…N,1…N],matI[1…N,1…N]w1[1…n],w2[1…n],w3[1…n] are workspace; xEIG2 does some of the work. Out: eigR,I[1…N, vecsR,I[1…N,1…N]. Err: 0=> success, j=> hit iteration limit on j'th eigen ; an external program.
xEIG2
# xCOD xEIG2(dum:num); only use with xCOMPLEX_EIG_SPLIT.; an external program.
###############
# The interface routine:
# Eigens calculates the eigenvalues and eigenvectors of
# a square complex (or real) NxN matrix. (N<=1000).
# The eigens of theMat[1…N, 1…N] are defined by
# theMat • theVecs[,j] = theEigs[j] * theVecs[,j]
# for 1<=j<=N.
#
program Eigens(theMat,theEigs,theVecs) # Finds theEigs,theVecs from theMat.
. var rm,im,er,ei,vr,vi,i,n,d, err, w1,w2,w3
. # Input :
. # theMat[1…N, 1…N] real or complex
. # Output:
. # theEigs[1…N]
. # theVecs[1…N,1…N] complex
. # Err: 0 for no error.
. begin
. d=dimension(theMat)
. if size(d)<>2 then
. Print("# •• ERROR : not a matrix.")
. else if d[1]<>d[2] then
. Print("# •• ERROR : not a square matrix.")
. else
. begin
. i = sqrt(-1) # just in case global "i" is different.